package cn.jaychang.demo.auth.server.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.InMemoryTokenStore;

/**
 * 令牌的配置
 *
 * @author jaychang
 * @since 2024/5/20
 **/
@Configuration
public class AccessTokenConfig {

    /**
     * 令牌存储策略
     * @return
     */
    @Bean
    public TokenStore tokenStore() {
        // 暂时使用内存存储，一旦服务重启令牌失效，后续可以改用数据库存储
        return new InMemoryTokenStore();
    }
}
